package cn.com.git.example.module.service.dto;

import cn.com.git.example.common.base.BaseForm;
import cn.com.git.example.common.util.object.MapperFacadeUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import java.util.function.Function;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2021/3/6 0006 10:17
 */
@Validated
@ApiModel
@Data
public class DemoSaveForm extends BaseForm {

    @ApiModelProperty("id")
    private Integer id;
    @ApiModelProperty("title")
    private String title;
    @ApiModelProperty("createTime")

    /**
     * 转换
     */
    public static Function<DemoSaveForm, DemoDTO> TO = (form) -> {
        return MapperFacadeUtils.map(form,DemoDTO.class);
    };
    /**
     * 转换
     */
    public static Function<DemoDTO, DemoSaveForm> FROM = (dto) -> {
        return null;
    };
}
